package com.hkbigdata.transfer;

import org.apache.flink.api.common.functions.IterationRuntimeContext;
import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.api.common.functions.RichMapFunction;
import org.apache.flink.api.common.functions.RuntimeContext;
import org.apache.flink.api.java.tuple.Tuple2;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * @author liuanbo
 * @creat 2024-04-12-16:57
 * @see 2194550857@qq.com
 */
public class Flink01_TransForm_Map_Anonymous {
    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        env.setParallelism(1);
        env.fromElements(1, 3, 4, 5, 6)
                .map(new RichMapFunction<Integer, Tuple2<String,Integer>>() {
                    @Override
                    public Tuple2<String, Integer> map(Integer value) throws Exception {
                        return null;
                    }

                    @Override
                    public void setRuntimeContext(RuntimeContext t) {
                        super.setRuntimeContext(t);
                    }

                    @Override
                    public RuntimeContext getRuntimeContext() {
                        return super.getRuntimeContext();
                    }

                    @Override
                    public IterationRuntimeContext getIterationRuntimeContext() {
                        return super.getIterationRuntimeContext();
                    }

                    @Override
                    public void open(Configuration parameters) throws Exception {
                        super.open(parameters);
                    }

                    @Override
                    public void close() throws Exception {
                        super.close();
                    }
                }).print();
/*                .map(data -> data * data)
                .print();*/

        env.execute();
    }
}
